package com.dly.hope.workflow;

import com.dly.hope.modle.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

/**
* @Name: NodeRole
* @Description: 节点审批角色
* @Author: Danny Chen
* @Date: 2022/1/18
*/
@Entity
@Table(name = "wfl003_node_role")
@Data
@DynamicInsert
@DynamicUpdate
public class NodeRole extends BaseEntity {

    @Id
    @GenericGenerator(name = "uuid", strategy = "org.hibernate.id.UUIDGenerator")
    @GeneratedValue(generator = "uuid")
    @Column(name = "id", nullable = false)
    private String id;

    /**
     * 节点ID
     */
    @Column(name = "node_id")
    private String nodeId;

    /**
     * 节点定义对象
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "node_id", updatable = false, insertable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    private NodeInfo nodeInfo;

    /**
     * 角色ID
     */
    @Column(name = "role_id")
    private String roleId;

//    /**
//     * 角色对象
//     */
//    @ManyToOne(fetch = FetchType.LAZY)
//    @JoinColumn(name = "role_id", updatable = false, insertable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
//    private RoleInfo roleInfo;

}
